package com.zzyl.mapper;


import com.github.pagehelper.Page;
import com.zzyl.entity.NursingPlan;
import com.zzyl.entity.NursingProjectPlan;
import com.zzyl.vo.NursingPlanVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NursingPlanMapper {
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int update(NursingPlan nursingPlan);

    int deleteById(@Param("id") Long id);

    NursingPlanVo selectById(@Param("id") Integer id);

    Page<NursingPlanVo> Pageselect(@Param("name") String name, @Param("status") Integer status);


    void insertNursingPlan(List<NursingProjectPlan> list);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into nursing_plan (plan_name,create_time,update_time,create_by,update_by) values (#{planName},#{createTime},#{updateTime},#{createBy},#{updateBy})")
    void insert(NursingPlan nursingPlan);

    @Select("select * from nursing_plan")
    List<NursingPlanVo> selectAllNursingPlan();

    @Delete("delete from nursing_plan where id =#{id}")
    void deleteNursingPlanById(Long id);

    @Delete("delete from nursing_project_plan where plan_id=#{id}")
    void deleteNursingProjectPlanById(Long id);

    @Update("update nursing_plan set status=#{status} where id=#{id} ")
    void updateStatus(@Param(value = "id") Long id, Integer status);

    Integer selectCountByPlanName(@Param(value = "planName") String planName);

    Integer selectModifyCountByPlanName(@Param(value = "planName") String planName,@Param(value = "id") Long id);
}
